class CreateAllForeignKeys < ActiveRecord::Migration
  def self.up
    #add a foreign key
    execute <<-SQL
      ALTER TABLE empleados_locales
        ADD CONSTRAINT fk_empleados
        FOREIGN KEY (empleado_id)
        REFERENCES empleados(id)
    SQL

    execute <<-SQL
      ALTER TABLE empleados_locales
        ADD CONSTRAINT fk_locales
        FOREIGN KEY (local_id)
        REFERENCES locales(id)
    SQL
  end

  def self.down
    execute "ALTER TABLE empleados_locales DROP FOREIGN KEY fk_empleados"
    execute "ALTER TABLE empleados_locales DROP FOREIGN KEY fk_locales"
  end
end